#!/usr/bin/env python 
# encoding: utf-8 
# @Author: Jacqueline
# @file: login_page.py
# @time: 2021/2/24 15:08

from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
class LoginPage:
    def __init__(self,driver):
        self.driver = driver
    """
    登录页面：
    1.登录操作（输入账号、密码，点击登录）
    2.获取弹框提示
    """
    def login(self,account,password):
        self.driver.find_element_by_xpath('.//li/p/input[@type="text"]').send_keys(account)
        self.driver.find_element_by_xpath('//input[@type="password"]').send_keys(password)
        self.driver.find_element_by_xpath('//span[@class="button"]').click()

    def get_error_text(self):
        res = self.driver.find_element_by_xpath('').text
        return res
    def get_pop_message(self):
        ele = WebDriverWait(self.driver, 5, 0.2).until(
            EC.visibility_of_element_located((By.XPATH, "//div[@class='mes warning']"))
        )
        return ele.text